find complexity of algorithm